<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>导航菜单</title>
		<link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
	</head>
	<body>
		<div id="ele">
			<!--default-active设置默认激活的位置(设置默认激活哪个导航菜单)。    mode控制横向 删除后是纵向-->
			<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" background-color="#545c64" @select="handleSelect">
			  <el-menu-item index="1">处理中心</el-menu-item>
			  <el-submenu index="2">
			    <template slot="title">我的工作台</template>
			    <el-menu-item index="2-1">选项1</el-menu-item>
			    <el-menu-item index="2-2">选项2</el-menu-item>
			    <el-menu-item index="2-3">选项3</el-menu-item>
			    <el-submenu index="2-4">
			      <template slot="title">选项4</template>
			      <el-menu-item index="2-4-1">选项1</el-menu-item>
			      <el-menu-item index="2-4-2">选项2</el-menu-item>
			      <el-menu-item index="2-4-3">选项3</el-menu-item>
			    </el-submenu>
			  </el-submenu>
			  <el-menu-item index="3" disabled>消息中心</el-menu-item>
			  <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">订单管理</a></el-menu-item>
			</el-menu>
			
			
			<div class="line"></div>
			<!--  这个导航菜单就比上边的多了三个样式 background-color="#545c64" text-color="#fff"  active-text-color="#ffd04b" -->
			<el-menu
			  :default-active="activeIndex2"
			  class="el-menu-demo"
			  mode="horizontal"
			  @select="handleSelect"
			  background-color="#545c64"
			  text-color="#fff"
			  active-text-color="#ffd04b">
			  <el-menu-item index="1">处理中心</el-menu-item>
			  <el-submenu index="2">
			    <template slot="title">我的工作台</template>
			    <el-menu-item index="2-1">选项1</el-menu-item>
			    <el-menu-item index="2-2">选项2</el-menu-item>
			    <el-menu-item index="2-3">选项3</el-menu-item>
			    <el-submenu index="2-4">
			      <template slot="title">选项4</template>
			      <el-menu-item index="2-4-1">选项1</el-menu-item>
			      <el-menu-item index="2-4-2">选项2</el-menu-item>
			      <el-menu-item index="2-4-3">选项3</el-menu-item>
			    </el-submenu>
			  </el-submenu>
			  <el-menu-item index="3" disabled>消息中心</el-menu-item>
			  <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">订单管理</a></el-menu-item>
			</el-menu>
			
			
			<h1>自己的菜单栏</h1>
			<el-menu style="width: 800px;"
			  :default-active="activeIndex2"
			  class="el-menu-demo"
			  mode="horizontal"
			  @select="handleSelect"
			  background-color="#545c64"
			  text-color="#fff"
			  active-text-color="#ffd04b">
				<el-menu-item v-for="(item,i) in arr" :index="i+1+''">{{item}}</el-menu-item>
			</el-menu>
		
		</div>
	</body>
	<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
	<!-- import JavaScript -->
	<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
	<script>
		let v=new Vue({
			el:"#ele",
			data:function(){
				return{
					activeIndex:'1',
					activeIndex2:'1',
					arr:["数学","语文","英语","物理","地理"]
				}
			},methods:{
				handleSelect(key,keyPath){
					//key代表选择的位置, keyPath代表完整的位置路径
					console.log(key,keyPath);
				}
			}
		});
	</script>
</html>
